//
//  XKLPlaceColorTextField.m
//  GuiZiShouDuanZi
//
//  Created by xmg on 16/4/28.
//  Copyright © 2016年 xiao_kl. All rights reserved.
//

#import "XKLPlaceColorTextField.h"
#import <objc/runtime.h>

@implementation XKLPlaceColorTextField
// _placeholderLabel

-(void)awakeFromNib{
    //用runtime获取成员变量
//    unsigned int count=0;
//    
//    Ivar *ivar=class_copyIvarList([UITextField class], &count);
//    
//    for (int i=0; i<count; i++) {
//        NSLog(@"%s",ivar_getName(ivar[i]));
//    }
    
    
    
    //设置光标的样式
    self.tintColor=self.textColor;
}

-(BOOL)becomeFirstResponder{
    //用kvc设置属性
    [self setValue:[UIColor whiteColor] forKeyPath:@"placeholderLabel.textColor"];
    return [super becomeFirstResponder];
}

-(BOOL)resignFirstResponder{
    
    [self setValue:[UIColor grayColor] forKeyPath:@"placeholderLabel.textColor"];
    return [super resignFirstResponder];
}


@end
